<!-- 测试node的express请求后能否发送数据过来 -->
<template>
  <div>
    <button @click="get">发送请求</button>
    <div>
      {{backData}}
    </div>
  </div>
</template>

<script>
  import axios from 'axios'
  export default {
    name: "testExpressRequest",
    data() {
      return {
        backData: 'clw',
        item: 'cc'
      }
    },
    watch: {
      backData: {
        handler(val) {
          console.log(this.item)
        },
        immediate: true
      }
    },
    methods: {
      get(){
        axios({
          method: 'get',
          url: 'http://localhost:8999/music',
        }).then(res => {
          console.log(res);
          this.backData = res.data

        }).catch(err => console.log(err))
      }
    },
    created() {
      console.log(this.backData);
    }
  }
</script>

<style scoped>

</style>
